<!-- 卡片>TOOLS -->
<template>
<div class="columnChart">
    <div class="tools-group">
        <!-- 返回首页 -->
        <el-tooltip class="item" effect="dark" content="返回首页">
          <div @click="$Ctl.backHome()">
              <img src="@/assets/images/homeLeft/home-iocn.png" alt="">
          </div>
        </el-tooltip>
        <!-- 返回首页--最近单单位 -->
        <el-tooltip class="item" effect="dark" content="返回单位首页">
          <div v-if="isMuilUnitUser" v-show="isSingleHome" @click="$Ctl.enterSingleHome({orgId:orgId})">
              <img src="@/assets/images/homeLeft/icon-single.png" alt="">
          </div>
        </el-tooltip>
        <!-- 推送设置  -->
        <el-tooltip class="item" effect="dark" content="系统设置">
          <div @click="$Ctl.openPopup('WebsocketSet')">
              <img src="@/assets/images/homeLeft/set-icon.png" alt="">
          </div>
        </el-tooltip>
        <!-- 地图工具包 -->
        <el-tooltip class="item" effect="dark" content="地图工具包">
          <div v-if="showMapTool" @click="$Ctl.openPopup('ToolsMap')">
              <img src="@/assets/images/homeLeft/fix-icon.png" alt="">
          </div>
        </el-tooltip>
        <!--关闭系统 -->
        <el-tooltip v-if="!$store.state.isAutoLogin" class="item" effect="dark" content="关闭系统">
          <div @click="$Ctl.closeSystem()">
              <img src="@/assets/images/homeLeft/close-icon.png" alt="">
          </div>
        </el-tooltip>
        <!-- 语音指令 -->
        <template v-if="showVoice">
          <el-tooltip class="item" effect="dark" content="语音指令">
            <div @click="$Ctl.voiceCmd()">
                <img src="@/assets/images/homeLeft/voice-icon.png" alt="">
            </div>
          </el-tooltip>
        </template>
    </div>
</div>
</template>

<script>
export default {
  data() {
    return {
      isSingleHome:false,
      homeType: 1,
      orgId:this.$store.state.userInfo.organizationIds,
      isMuilUnitUser:this.$store.state.userInfo.isMuilUnitUser,//0:单单位用户;1:多单位用户
      showVoice:this.bsConfig.showVoice!==false
    }
  },
  watch: {
    homeType(value){
      //TODO  value==3  子页面判断
      if(value==1){
        this.isSingleHome = false;
      }else if(value==2){
        this.isSingleHome = true;
      }
    }
  },
  computed:{
    showMapTool(){
      return this.$store.state.currentMapType!=4 // unity地图不支持地图工具包
    }
  },
  created() {
    /**
     * 更改工具栏展示的内容
     */ 
    window.FunList.changeToolsModelShow = this.changeToolsShow
  },
  methods: {
    changeToolsShow(type,orgId) {
      let that = this
      that.homeType = type || 1
      that.orgId = orgId || that.$store.state.userInfo.organizationIds
    },
  }
}
</script>
<style scoped rel="stylesheet/scss" lang="scss">
.columnChart{
  // height: 100%;
  width: 100%;
  .tools-group{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    width: 100%;
    z-index: 100;
    div{
      cursor: pointer;
      width: 55px;
      height: 55px;
      img{
        width: 100%;
        height: 100%;
      }
    }
  }
}
</style>